using System;
using System.Linq.Expressions;
using System.Reflection;

namespace PropertyExpression.ReactiveRelation
{
    internal class PropertyExpressionProxy<TEntity, TProperty> 
        : IPropertyExpressionProxy<TEntity, TProperty>
    {
        private readonly Expression<Func<TEntity, TProperty>> propertyExpression;

        public PropertyExpressionProxy(Expression<Func<TEntity, TProperty>> propertyExpression)
        {
            this.propertyExpression = propertyExpression;
        }

        public PropertyInfo GetPropertyInfo()
        {
            return propertyExpression.GetPropertyInfo();
        }

        public TProperty Execute(TEntity entity)
        {
            return propertyExpression.Execute(entity);
        }
    }
}